# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.ContainerAnalysis.V1beta1.Model.Link do
  @moduledoc """
  This corresponds to an in-toto link.

  ## Attributes

  *   `byproducts` (*type:* `GoogleApi.ContainerAnalysis.V1beta1.Model.ByProducts.t`, *default:* `nil`) - ByProducts are data generated as part of a software supply chain step, but are not the actual result of the step.
  *   `command` (*type:* `list(String.t)`, *default:* `nil`) - This field contains the full command executed for the step. This can also be empty if links are generated for operations that aren't directly mapped to a specific command. Each term in the command is an independent string in the list. An example of a command in the in-toto metadata field is: "command": ["git", "clone", "https://github.com/in-toto/demo-project.git"]
  *   `environment` (*type:* `GoogleApi.ContainerAnalysis.V1beta1.Model.Environment.t`, *default:* `nil`) - This is a field that can be used to capture information about the environment. It is suggested for this field to contain information that details environment variables, filesystem information, and the present working directory. The recommended structure of this field is: "environment": { "custom_values": { "variables": "", "filesystem": "", "workdir": "", "": "..." } }
  *   `materials` (*type:* `list(GoogleApi.ContainerAnalysis.V1beta1.Model.GrafeasV1beta1IntotoArtifact.t)`, *default:* `nil`) - Materials are the supply chain artifacts that go into the step and are used for the operation performed. The key of the map is the path of the artifact and the structure contains the recorded hash information. An example is: "materials": [ { "resource_uri": "foo/bar", "hashes": { "sha256": "ebebf...", : } } ]
  *   `products` (*type:* `list(GoogleApi.ContainerAnalysis.V1beta1.Model.GrafeasV1beta1IntotoArtifact.t)`, *default:* `nil`) - Products are the supply chain artifacts generated as a result of the step. The structure is identical to that of materials.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :byproducts => GoogleApi.ContainerAnalysis.V1beta1.Model.ByProducts.t() | nil,
          :command => list(String.t()) | nil,
          :environment => GoogleApi.ContainerAnalysis.V1beta1.Model.Environment.t() | nil,
          :materials =>
            list(GoogleApi.ContainerAnalysis.V1beta1.Model.GrafeasV1beta1IntotoArtifact.t()) | nil,
          :products =>
            list(GoogleApi.ContainerAnalysis.V1beta1.Model.GrafeasV1beta1IntotoArtifact.t()) | nil
        }

  field(:byproducts, as: GoogleApi.ContainerAnalysis.V1beta1.Model.ByProducts)
  field(:command, type: :list)
  field(:environment, as: GoogleApi.ContainerAnalysis.V1beta1.Model.Environment)

  field(:materials,
    as: GoogleApi.ContainerAnalysis.V1beta1.Model.GrafeasV1beta1IntotoArtifact,
    type: :list
  )

  field(:products,
    as: GoogleApi.ContainerAnalysis.V1beta1.Model.GrafeasV1beta1IntotoArtifact,
    type: :list
  )
end

defimpl Poison.Decoder, for: GoogleApi.ContainerAnalysis.V1beta1.Model.Link do
  def decode(value, options) do
    GoogleApi.ContainerAnalysis.V1beta1.Model.Link.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.ContainerAnalysis.V1beta1.Model.Link do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
